﻿@using FCTC_Web.Models
@model FCTC_Web.Utilities.Page<Shop>
@{
    ViewBag.Title = "Index";
    int current = 0;
    string styletr = "";
}
<h2>
    商家列表</h2>
<p>
    @Html.ActionLink("创建", "Create")
</p>
<style>
    table tr th
    {
        padding: 0px 15px;
        text-align: center;
        line-height: 30px;
    }
    table tr td
    {
        text-align: center;
    }
</style>
<table width="100%">
    <tr>
        <th>
            名称
        </th>
        <th>
            类型
        </th>
        <th>
            地址
        </th>
        <th>
            信誉度
        </th>
        <th>
            月累计销量
        </th>
        <th>
            图片(张)
        </th>
        <th>
            编辑人
        </th>
        <th>
            编辑时间
        </th>
        <th>
            操作
        </th>
    </tr>
    @foreach (var item in Model.CurrentRecords)
    {
        if (current % 2 == 1) { styletr = "background-color:#f6fdfd"; }
        else if (current % 2 == 0) { styletr = ""; }
        <tr style="@styletr">
            <td>
                @Html.DisplayFor(modelItem => item.FullName)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ShopType)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Address)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.TrustLevel)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.VehicleSaled)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.Imgs.Count)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.UpdatedUser)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.UpdateTime)
            </td>
            <td>
                @Html.ActionLink("编辑", "Edit", new { id = item.ID }) |
                @Html.ActionLink("编辑商家图片列表", "IndexForShop", "Image", new { relativeId = item.ID }, null)|
                @Html.ActionLink("详细信息", "Details", new { id = item.ID })
                @if (item.Imgs != null && item.Imgs.Count == 0)
                {
                    <span>|</span>
                    @Html.ActionLink("删除", "Delete", new { id = item.ID })
                }
            </td>
        </tr>
                current++;
    }
</table>
@Html.Pager(Model, "/Shop/Index")
